package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BrandMapper extends Mapper<Brand> {

    @Select("SELECT\n" +
            "\tb.name,b.image\n" +
            "FROM\n" +
            "\ttb_brand b\n" +
            "JOIN\n" +
            "\ttb_category_brand cb\n" +
            "ON\n" +
            "\tb.id = cb.brand_id\n" +
            "JOIN\n" +
            "\ttb_category c\n" +
            "ON\n" +
            "\tc.id = cb.category_id\n" +
            "WHERE\n" +
            "\tc.name = #{cateGoryName}")
    List<Map> findBrandByCateGoryName(@Param("cateGoryName") String cateGoryName);

}
